/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.library.model.impl;

import com.library.model.Book;
import com.library.model.BookModel;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.impl.BaseModelImpl;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.sql.Types;

/**
 * The base model implementation for the Book service. Represents a row in the &quot;Book_Book&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link com.library.model.BookModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link BookImpl}.
 * </p>
 *
 * <p>
 * Never modify or reference this class directly. All methods that expect a book model instance should use the {@link com.library.model.Book} interface instead.
 * </p>
 *
 * @author Velocity
 * @see BookImpl
 * @see com.library.model.Book
 * @see com.library.model.BookModel
 * @generated
 */
public class BookModelImpl extends BaseModelImpl<Book> implements BookModel {
	public static final String TABLE_NAME = "Book_Book";
	public static final Object[][] TABLE_COLUMNS = {
			{ "BookId", new Integer(Types.INTEGER) },
			{ "BookTitle", new Integer(Types.VARCHAR) },
			{ "Author", new Integer(Types.VARCHAR) }
		};
	public static final String TABLE_SQL_CREATE = "create table Book_Book (BookId INTEGER not null primary key,BookTitle VARCHAR(75) null,Author VARCHAR(75) null)";
	public static final String TABLE_SQL_DROP = "drop table Book_Book";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.com.library.model.Book"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.com.library.model.Book"),
			true);
	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.com.library.model.Book"));

	public BookModelImpl() {
	}

	public int getPrimaryKey() {
		return _BookId;
	}

	public void setPrimaryKey(int pk) {
		setBookId(pk);
	}

	public Serializable getPrimaryKeyObj() {
		return new Integer(_BookId);
	}

	public int getBookId() {
		return _BookId;
	}

	public void setBookId(int BookId) {
		_BookId = BookId;
	}

	public String getBookTitle() {
		if (_BookTitle == null) {
			return StringPool.BLANK;
		}
		else {
			return _BookTitle;
		}
	}

	public void setBookTitle(String BookTitle) {
		_BookTitle = BookTitle;
	}

	public String getAuthor() {
		if (_Author == null) {
			return StringPool.BLANK;
		}
		else {
			return _Author;
		}
	}

	public void setAuthor(String Author) {
		_Author = Author;
	}

	public Book toEscapedModel() {
		if (isEscapedModel()) {
			return (Book)this;
		}
		else {
			return (Book)Proxy.newProxyInstance(Book.class.getClassLoader(),
				new Class[] { Book.class }, new AutoEscapeBeanHandler(this));
		}
	}

	public Object clone() {
		BookImpl clone = new BookImpl();

		clone.setBookId(getBookId());
		clone.setBookTitle(getBookTitle());
		clone.setAuthor(getAuthor());

		return clone;
	}

	public int compareTo(Book book) {
		int pk = book.getPrimaryKey();

		if (getPrimaryKey() < pk) {
			return -1;
		}
		else if (getPrimaryKey() > pk) {
			return 1;
		}
		else {
			return 0;
		}
	}

	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		Book book = null;

		try {
			book = (Book)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		int pk = book.getPrimaryKey();

		if (getPrimaryKey() == pk) {
			return true;
		}
		else {
			return false;
		}
	}

	public int hashCode() {
		return getPrimaryKey();
	}

	public String toString() {
		StringBundler sb = new StringBundler(7);

		sb.append("{BookId=");
		sb.append(getBookId());
		sb.append(", BookTitle=");
		sb.append(getBookTitle());
		sb.append(", Author=");
		sb.append(getAuthor());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(13);

		sb.append("<model><model-name>");
		sb.append("com.library.model.Book");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>BookId</column-name><column-value><![CDATA[");
		sb.append(getBookId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>BookTitle</column-name><column-value><![CDATA[");
		sb.append(getBookTitle());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>Author</column-name><column-value><![CDATA[");
		sb.append(getAuthor());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private int _BookId;
	private String _BookTitle;
	private String _Author;
}